import request from '@/utils/request'

export function start(data) {
  return request({
    url: 'api/flowable/instance/start',
    method: 'post',
    data
  })
}

export function getDetail(id) {
  return request({
    url: 'api/flowable/instance/' + id,
    method: 'get'
  })
}

export function del(ids, cascade) {
  return request({
    url: 'api/flowable/instance',
    method: 'delete',
    params: {
      processInstanceId: ids,
      cascade: cascade
    }
  })
}

export function comments(id) {
  return request({
    url: 'api/flowable/instance/comments',
    method: 'get',
    params: { processInstanceId: id }
  })
}

export function form(id) {
  return request({
    url: 'api/flowable/instance/formData',
    method: 'get',
    params: { processInstanceId: id }
  })
}

export function image(id) {
  return request({
    url: 'api/flowable/instance/image?processInstanceId=' + id,
    method: 'get'
  })
}

export function activate(id) {
  return request({
    url: 'api/flowable/instance/activate',
    method: 'put',
    params: { processInstanceId: id }
  })
}

export function suspend(id) {
  return request({
    url: 'api/flowable/instance/suspend',
    method: 'put',
    params: { processInstanceId: id }
  })
}

export default { start, del, comments, form, image, activate, suspend, getDetail }
